#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(){
	char *names[5];char *t;
	int i,j;
	for(i = 0;i<5;i++){
		names[i] = (char*)malloc(sizeof(char)*20);
		gets(names[i]);
	}for(i = 0;i<5;i++){
		for(j = 5-i-1;j>0;j++){
			if(strcmp(names[j],names[j-1])<0){
				strcpy(names[j],t);strcpy(names[j-1],names[j]);strcpy(t,names[j-1]);
			}
		}
	}for(i = 0;i<5;i++){
		puts(names[i]);
	}
}
 
